package com.jiayi.furniture.user.service;

import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;

import com.jiayi.furniture.user.dao.IUserDao;
import com.jiayi.furniture.user.User;

@Service
public class UserServicesImpl  implements IUserServices{
	
	//日志
	private static Logger log = Logger.getLogger(UserServicesImpl.class);
		
	@Resource
	private IUserDao userDao;

	@Override
	public boolean addUser(User user) {
		
		return userDao.addUser(user);
	}

	@Override
	public boolean checkUser(User user) {
		log.info("检查用户是否存在");
		User ue = userDao.checkUser(user);
		if(ue!=null && ue.getPassword().equals(user.getPassword())){
			return true;
		}else{
			log.debug("账号为:"+user.getAccount()+"的用户不存在!");
			return false;
		}
	}

	@Override
	public boolean updateUser(User user) {
		return userDao.updateUser(user);
	}

	@Override
	public User getUser(Long id) {
		
		return null;
	}
}
